// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.linqingying.gitcode.pullrequest.ui.details.model

import com.intellij.collaboration.util.CollectionDelta
import com.intellij.openapi.progress.ProgressIndicator
import com.linqingying.gitcode.api.data.GCLabel
import com.linqingying.gitcode.api.data.GCUser
import com.linqingying.gitcode.api.data.pullrequest.GCPullRequestRequestedReviewer
import com.linqingying.gitcode.api.data.pullrequest.GCPullRequestReview
import java.util.concurrent.CompletableFuture

interface GCPRMetadataModel {
  val assignees: List<GCUser>
  val reviewers: List<GCPullRequestRequestedReviewer>
  val labels: List<GCLabel>
  val reviews: List<GCPullRequestReview>

  val isEditingAllowed: Boolean

  fun getAuthor(): GCUser?

  fun loadPotentialReviewers(): CompletableFuture<List<GCPullRequestRequestedReviewer>>
  fun adjustReviewers(indicator: ProgressIndicator, delta: CollectionDelta<GCPullRequestRequestedReviewer>): CompletableFuture<Unit>

  fun loadPotentialAssignees(): CompletableFuture<List<GCUser>>
  fun adjustAssignees(indicator: ProgressIndicator, delta: CollectionDelta<GCUser>): CompletableFuture<Unit>

  fun loadAssignableLabels(): CompletableFuture<List<GCLabel>>
  fun adjustLabels(indicator: ProgressIndicator, delta: CollectionDelta<GCLabel>): CompletableFuture<Unit>

  fun addAndInvokeChangesListener(listener: () -> Unit)
}
